const CreateWebSocketServer = (app) => {
  const { Server } = require("socket.io");
  const { createServer } = require("node:http");
    const httpServer = createServer(app);
  
  const io = new Server(httpServer, {
    cors: {
      origin: "*",
      methods: ["GET", "POST"],
      credentials: true,
      allowedHeaders: ["Content-Type"],
    },
  });
  return {
  ExpressServer:httpServer,
  WebSocketServer:io
  };
};
module.exports = CreateWebSocketServer